package org.enea.xlab.lezione3.crudmanager;

import java.io.Serializable;
import java.util.HashMap;

import javax.ejb.EJB;
import javax.ejb.Stateless;
import javax.interceptor.Interceptors;

import org.enea.xlab.lezione3.entity.Supplier;

/**
 * @author X-Lab
 * 
 * Wrapper remoto di CRUDManagerImpl locale
 */

@Stateless
@Interceptors({Profile.class})
public class CRUDManagerImplFacade implements CRUDManagerRemote, Serializable {
	
	@EJB(mappedName="CRUDManagerImpl/local")
	private CRUDManagerLocal domain;
	
	
	/**
	 * return null se gia' esiste
	 */
	public Long createSupplier(Supplier supplier) {
		
		return domain.createSupplier(supplier);
	}

	public Supplier readSupplier(Long supplierId) {
		
		return domain.readSupplier(supplierId);
	}

	public Boolean updateSupplier(Supplier supplier) {
		
		return domain.updateSupplier(supplier);
	}

	/**
	 * return false quando non cancella nulla
	 */
	public Boolean deleteSupplier(Long supplierId) {
		
		return domain.deleteSupplier(supplierId);
	}
	
	public HashMap getRegister()
	{
		return domain.getRegister();
	}
}
